package iterator.collegeDisplay.aggregate.college;

import iterator.collegeDisplay.aggregate.college.base.College;
import iterator.collegeDisplay.iterator.ComputerCollegeIterator;
import iterator.collegeDisplay.leaf.Department;

import java.util.Iterator;

public class ComputerCollege implements College {

    public final int MAXSIZE = 10;

    private Department[] departments;
    int numOfDepartments = 0;

    public ComputerCollege() {
        this.departments = new Department[MAXSIZE];
    }

    @Override
    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }

    @Override
    public String getName() {
        return "COM";
    }

    @Override
    public void addDepartment(String name, String desc) {
        departments[numOfDepartments ++] = new Department(name, desc);
    }
}
